package factory;

import template.Zh0202ConcreteTemplateA;
import template.Zh0202ConcreteTemplateB;
import template.Zh0202Template;

import java.util.ArrayList;
import java.util.HashMap;

/**
 * @author: zh
 * @date: 2021/12/3 17:13
 * @version: 1.0
 */
public class Zh0202TemplateFactory {
    private ArrayList<Zh0202Template> templates = new ArrayList<Zh0202Template>();
    private int totalUser;

    public Zh0202TemplateFactory() {
        Zh0202Template a = new Zh0202ConcreteTemplateA("天上人间");
        Zh0202Template b = new Zh0202ConcreteTemplateB("圣帝国际");
        templates.add(a);
        templates.add(b);
    }

    public Zh0202Template getTemplate(String logo){
        if (logo.equals("天上人间")){
            totalUser++;
            return templates.get(0);
        }else if (logo.equals("圣帝国际")){
            totalUser++;
            return templates.get(1);
        }else {
            return null;
        }
    }

    public int getTotalTemplates(){
        return templates.size();
    }

    public int getTotalUser(){
        return totalUser;
    }
}
